Repository navigation
fix: studio skip reason i18n - #320
Conversation
Reviewer's GuideData structuresChange AI-assist skipped results to expose the conflicting item instead of a presentation-ready reason string.
ImplementationTrack which item holds each occupied slot so skipped suggestions can identify the item they conflict with, including items merged earlier in the same call.
UIShow translated labels for the suggested and conflicting items in the skip toast, and use translated type labels for canvas items without a role.
TestsCover translated item labels in the Studio panels and verify the merge reports the correct conflicting item.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="frontend/components/studio/canvas-panel.tsx" line_range="23" />
<code_context>
const roleLabel = (type: string) => {
const role = ITEM_ROLE[type];
- return role ? roleName(role) : type;
+ return role ? roleName(role) : typeLabel(type);
};
if (items.length === 0) {
</code_context>
<issue_to_address>
**Unknown types stay in English**
When a canvas or studio item has a type with no matching catalog entry, `typeLabel` calls `useCatalogLabel`, which falls back to title-cased raw text for an absent type, so the item label remains in English instead of the current locale.
Provide a localized fallback for types that are absent from the catalog instead of displaying humanized raw text.
Also at `frontend/tests/studio-panels-i18n.test.tsx:24`.
</issue_to_address>
### Comment 2
<location path="frontend/tests/studio-panels-i18n.test.tsx" line_range="23" />
<code_context>
+ t.raw = t
+ t.rich = t
+ t.markup = t
+ t.has = () => true
+ return t
+ },
</code_context>
<issue_to_address>
**Unknown type expects a nonexistent translation**
When the test is meant to verify the label produced with the real catalog, when `kimono` is absent from the real English type catalog, `useCatalogLabel` correctly falls back to `Kimono`, but this mock forces `t.has` to return true and fabricates `constants.types.kimono`, so the CanvasPanel assertion passes with output the real catalog would not produce.
Use a type present in the catalog for the translation assertion, or assert the readable fallback for `kimono` and make the mock's `has` reflect catalog membership.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: frontend/components/studio/canvas-panel.tsx:23, frontend/tests/studio-panels-i18n.test.tsx:23
| const roleLabel = (type: string) => { | ||
| const role = ITEM_ROLE[type]; | ||
| return role ? roleName(role) : type; | ||
| return role ? roleName(role) : typeLabel(type); |
There was a problem hiding this comment.
🟡 Medium · Unknown types stay in English
When a canvas or studio item has a type with no matching catalog entry, typeLabel calls useCatalogLabel, which falls back to title-cased raw text for an absent type, so the item label remains in English instead of the current locale.
Provide a localized fallback for types that are absent from the catalog instead of displaying humanized raw text.
Also at frontend/tests/studio-panels-i18n.test.tsx:24.
Prompt for AI agents
In `frontend/components/studio/canvas-panel.tsx` at line 23:
**Unknown types stay in English**
When a canvas or studio item has a type with no matching catalog entry, `typeLabel` calls `useCatalogLabel`, which falls back to title-cased raw text for an absent type, so the item label remains in English instead of the current locale.
Provide a localized fallback for types that are absent from the catalog instead of displaying humanized raw text.
Also at `frontend/tests/studio-panels-i18n.test.tsx:24`.| t.raw = t | ||
| t.rich = t | ||
| t.markup = t | ||
| t.has = () => true |
There was a problem hiding this comment.
🟡 Medium · Unknown type expects a nonexistent translation
When the test is meant to verify the label produced with the real catalog, when kimono is absent from the real English type catalog, useCatalogLabel correctly falls back to Kimono, but this mock forces t.has to return true and fabricates constants.types.kimono, so the CanvasPanel assertion passes with output the real catalog would not produce.
Use a type present in the catalog for the translation assertion, or assert the readable fallback for kimono and make the mock's has reflect catalog membership.
Prompt for AI agents
In `frontend/tests/studio-panels-i18n.test.tsx` at line 23:
**Unknown type expects a nonexistent translation**
When the test is meant to verify the label produced with the real catalog, when `kimono` is absent from the real English type catalog, `useCatalogLabel` correctly falls back to `Kimono`, but this mock forces `t.has` to return true and fabricates `constants.types.kimono`, so the CanvasPanel assertion passes with output the real catalog would not produce.
Use a type present in the catalog for the translation assertion, or assert the readable fallback for `kimono` and make the mock's `has` reflect catalog membership.
Description
Related Issue
Type of Change
Checklist
Testing
Test Environment
Tests Performed
Screenshots (if applicable)
Additional Notes
Summary by Sourcery
Fix studio item and AI-assist skip messaging so all labels are localized and conflicts identify the relevant existing item.
Bug Fixes:
Enhancements:
Tests: